const path = require('path')

class homeCtl {
    index(ctx) {
        ctx.body = '请求主页'
    }

    upload(ctx) {
        const file = ctx.request.files.file
        const basename = path.basename(file.path)
        ctx.body = {
            url: `${ctx.origin}/uploads/${basename}`
        }
    }
}

module.exports = new homeCtl()